# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=cvechecker
pkgver=4.0
pkgrel=1
pkgdesc="A local CVE checker tool"
url="https://github.com/sjvermeu/cvechecker/wiki"
arch="all"
license="GPL-3.0"
depends="gawk wget libxslt jq"
makedepends="libconfig-dev sqlite-dev mariadb-connector-c-dev
	argp-standalone autoconf automake libbsd-dev"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="$pkgname-doc"
pkggroups="$pkgname"
source="$pkgname-$pkgver.zip::https://github.com/sjvermeu/cvechecker/archive/cvechecker-$pkgver.zip"
builddir="$srcdir"/$pkgname-$pkgname-$pkgver

prepare() {
	default_prepare
	cd "$builddir"
	aclocal && \
	autoheader && \
	automake -ac && \
	autoreconf --install
}

build() {
	export LIBS="-largp"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--enable-sqlite3 \
		--enable-mysql
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir"/var/cvechecker &>/dev/null
	chgrp -R $pkggroups "$pkgdir"/var/cvechecker/* &>/dev/null
	chmod -R g+w "$pkgdir"/var/cvechecker &>/dev/null
}

sha512sums="f2c4e8ca5cbeed00b543b64e9173c64bd7d423e4cdda0731e7e79a85b81468f066bbd9903c630b58342c24e19c11b8a6b9f4c7fafe109c129d6b0baadb65aeb2  cvechecker-4.0.zip"
